package hihocoder;
import java.util.ArrayList;
import java.util.Scanner;

/**
 * 
 */

/**
 * @author zhongfang
 *
 */
public class LittleChance2 {
	public static int yueshu(long a) {
		int result=0;
		for(int i=1;i<Math.sqrt(a);i++){
			if(a%i==0){
				result+=2;
			}
		}
		double sq=Math.sqrt(a);
		if(sq*sq==a)
			result++;
		return result;
	}
	public static long getGCD(long a,long b) {
		long m=a;
		long n=b;
		long gcd=1;
		while (m%n!=0) {
			long tmp=m%n;
			m=n;
			n=tmp;
		}
		return gcd;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		long A=scanner.nextLong();
		long B=scanner.nextLong();
		int aCount=yueshu(A);
		int bCount=yueshu(B);
		
		long gcd=getGCD(A, B);
		int cCount=yueshu(gcd);
		//结果是 cCount/(aCount*bCount)
		gcd=getGCD(aCount, cCount);
		aCount/=gcd;
		cCount/=gcd;
		gcd=getGCD(bCount, cCount);
		bCount/=gcd;
		cCount/=gcd;
		System.out.println(aCount*bCount+" "+cCount);
	}
}
